//1.0 导入vue核心包
import Vue from "vue";

//2.0 导入App.vue 的vue对象
import App from  "./App.vue";

//3.0 将vue-router集成到这个项目中来
import vueRouter from "vue-router";
    //3.01将vueRouter对象绑定到Vue对象上
Vue.use(vueRouter);
    //3.02 导入路由对应的组件对象
import home from "./components/home.vue";
import shopcar  from "./components/shopcar/car.vue";
import newslist  from "./components/news/newslist.vue";
import newsinfo  from "./components/news/newsinfo.vue";
import comment  from "./components/subcom/comment.vue";
import photolist  from "./components/photo/photolist.vue";

    //3.03 定义路由规则
var router=new vueRouter({
    linkActiveClass:"mui-active",
    routes:[
        {path:"*",redirect:"/"},//如果匹配不到任何规则，就会默认跳转到根目录，即首页。如果需要跳转到404页面，需要另外建一个组件
        {path:"/",redirect:"/home"},
        {path:"/home",component:home},
        {path:"/shopcar",component:shopcar},
        {path:"/news/newslist",component:newslist},
        {path:"/news/newsinfo/:id",component:newsinfo},
        {path:"/news/newsinfo/:id",component:newsinfo},
        {path:"/photo/photolist",component:photolist}
    ]
})

//4.0 导入vue-resource并在vue中绑定，自动在vue实例对象上注入一个$http对象就可以使用ajax请求数据
import vueResource from "vue-resource";
Vue.use(vueResource);


//5.0  引入mint ui全部组件
import Mint from 'mint-ui';
import "mint-ui/lib/style.min.css";//导入mint-ui的css文件
    // 5.01 在vue全局中使用mint-ui
Vue.use(Mint);

//6.0 引入mui的css样式,css样式文件没有返回值不需要use
import "../statics/mui/css/mui.css";

//7.0 引入公共css样式
import "../statics/css/common.css";

//8.0 引入日期处理类库
import moment from "moment";
    // 8.01 自定义日期过滤器
Vue.filter("datefmt",function(input,fmtstring){
    return moment(input).format(fmtstring);
})



Vue.use(Mint);
//3.0 利用vue对象进行解析渲染
new Vue({
    el:"#app",
     //使用路由实例对象
    router,
    render:c=>c(App)
})